/**
 * 功能描述：图表工厂控制器
 * @author jin xiaohang
 * @date 2022/9/26 15:24
 * @version 1.0
 */

import * as eCharts from "echarts";
class YwBaseChartController {

    static instance(props){
        return new YwBaseChartController(props)
    }

    constructor(props) {
        this.props = props
    }

    /**
     * 属性对象
     * @type {null}
     * @private
     */
    _props=null;

    /**
     * 暂存vue视图
     * @type {null}
     * @private
     */
    _vueView = null

    get vueView(){
        return this._vueView;
    }

    set vueView(value){
        this._vueView = value
    }

    get props(){
        return this._props;
    }

    set props(value){
        this._props = value
    }


    /**
     * 安装自己
     * @param vueView {Object}  vue视图
     */
    mounted(vueView){
        this.vueView = vueView
        let id = this.props.id
        let chart = eCharts.init(document.getElementById(id));
        chart.setOption(this.props)
    }
}
export default YwBaseChartController;